home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of a generic input source
-
- #include "NSDLL.h"
-
- #define data(i,j) data[j+i*cols]
-
- /***************************/
- /* Activation of component */
- __declspec(dllexport) void performInput(
- DLLData *instance, // Pointer to instance data (may be NULL)
- NSFloat *data, // Pointer to the data
- int rows, // Number of rows of data
- int cols // Number of cols of data
- )
- {
- int i,j;
- for (i=0; i<rows; i++)
- for (j=0; j<cols; j++)
- data(i,j) = 0.0f; // You define your own input source.
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
- /*
- __declspec(dllexport) DLLData *allocInput(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- int rows, // Number of rows of data
- int cols // Number of cols of data
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- return instance;
- }
-
- __declspec(dllexport) void freeInput(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
- */
-
-
- // Dynamic link library implementation of a generic pre/post-processor
-
- #include "NSDLL.h"
-
- /***************************/
- /* Activation of component */
- __declspec(dllexport) BOOL performPrePost(
- DLLData *instance, // Pointer to instance data (may be NULL)
- NSFloat *input, // Pointer to the input data
- NSFloat *output, // Pointer to the output data
- int rows, // Number of rows of data
- int cols // Number of cols of data
- )
- {
- int i, length=rows*cols;
- for (i=0; i<length; i++)
- output[i] += input[i];
- return TRUE; // Return whether to inject this sample or to call performPrePost with another sample
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
- /*
- __declspec(dllexport) DLLData *allocPrePost(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- int *rows, // Number of rows of output data, can be changed to reflect a diffenent number for the input data
- int *cols, // Number of cols of output data, can be changed to reflect a diffenent number for the input data
- BOOL preprocessor // Flag to indicate whether this is a preprocessor or postprocessor
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- return instance;
- }
-
- __declspec(dllexport) void freePrePost(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
- */
-